﻿using IMDBApi.App.Views;
using System.Windows.Forms;

namespace IMDBApi.App
{
    public partial class MainForm : Form
    {
        /// <summary>
        /// ...
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form_Load(object sender, System.EventArgs e)
        {
            ChangeUserControl(new MainView(this));

            this.tsWatchPath.Text = string.Format("Service Watch-Folder: '{0}'", Configurations.MOVIE_LIB);
        }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QuitMenuItem_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="view"></param>
        public void ChangeUserControl(UserControl view)
        {
            view.Dock = DockStyle.Fill;
            this.pContainer.Controls.Clear();
            this.pContainer.Controls.Add(view);
        }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="message"></param>
        /// <param name="image"></param>
        public void SetStatus(string message, System.Drawing.Image image = null)
        {
            this.tsStatus.Text = string.Format("{0}", message);

            if (image != null)
                this.tsStatus.Image = image;
        }

        /// <summary>
        /// ...
        /// </summary>
        /// <param name="value"></param>
        public void SetLoader(bool value)
        {
            this.tsLoader.Visible = value;
        }
    }
}
